package com.chrray.position.controller.web;

import com.chrray.position.domain.FdJobPostings;
import com.chrray.position.domain.FdUser;
import com.chrray.position.entity.position.FdJobPostingsExe;
import com.chrray.position.entity.position.FdUserExe;
import com.chrray.position.enums.app.FdJobStateEnum;
import com.chrray.position.pojo.dto.BaseIdDto;
import com.chrray.position.service.web.WFdJobPostingsService;
import com.chrray.position.service.web.WFdUserService;
import com.chrray.position.util.result.PageBean;
import com.chrray.position.util.result.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import static com.chrray.position.util.result.ResponseResults.PAGE;
import static com.chrray.position.util.result.ResponseResults.success;

/**
 * 业务系统用户控制器
 *
 * @author lm
 * @since 1.0.1 2024-09-02
 */
@RestController
@RequestMapping("/api/web/myPostings")
@Api(tags = "我的发布")
@AllArgsConstructor
public class WFdMyJobPostingsController {
    @Autowired
    private WFdJobPostingsService wFdJobPostingsService;
    @Autowired
    private WFdUserService wFdUserService;


    @GetMapping("/pageMyPostingsList")
    @ApiOperation("列表(参数userId)")
    public ResponseResult<PageBean<FdJobPostings>> pageList(FdJobPostingsExe entity) {
        return PAGE(wFdJobPostingsService.FdJobPostings(entity));
    }


    @GetMapping("/selectById")
    @ApiOperation("查询详情")
    @ApiResponses({
            @ApiResponse(code=200, message = "ok", response = FdJobPostings.class)
    })
    public ResponseResult<FdJobPostings> selectById(BaseIdDto dto){
        return  wFdJobPostingsService.selectById(dto.getId());
    }

    @GetMapping("/pagePostingsUserList")
    @ApiOperation("待录用/已录用/列表")
    public ResponseResult<PageBean<FdUserExe>> pagePostingsUserList(FdUserExe fdUser) {
        return PAGE(wFdUserService.pagePostingsUserList(fdUser));
    }





}
